package com.fly.feishu.web.controller;

import com.fly.feishu.api.service.FeishuTokenService;
import com.fly.feishu.web.helper.FeishuUserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/")
public class IndexContreller {

    @Autowired
    private FeishuTokenService feishuTokenService;

    @RequestMapping("/")
    public ModelAndView indexPage() {
        ModelAndView model = new ModelAndView("index");
        model.setViewName("index");
        return model;
    }

    /**
     * 用户信息
     *
     * @return
     */
    @RequestMapping("/profile")
    public ModelAndView profile() {
        ModelAndView model = new ModelAndView("profile");
//        WebAccessToken webAccessToken = new WebAccessToken();
//        webAccessToken.setAvatarUrl("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.pianshen.com%2Fthumbs%2F884%2Fcff4861ea220253d9205e181f139e514.png&refer=http%3A%2F%2Fwww.pianshen.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1634492593&t=67f57e8eaf37bac09751b2d2655664d1");
//        webAccessToken.setName("大呲花");
//        webAccessToken.setEnName("big-flower");
//        webAccessToken.setEmail("123@fly67.cn");
//        webAccessToken.setMobile("15776621927");
//        model.addObject("info", webAccessToken);
        model.addObject("info", FeishuUserContext.getCurrentWebToke());
        return model;
    }

    /**
     * 页面
     */
    public void pageForward() {

    }
}
